package com.zmc.lostfound.post.dao;

import com.zmc.lostfound.post.entity.CommentEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author ZMC
 * @email 2869581855@qq.com
 * @date 2023-07-05 15:49:44
 */
@Repository
public interface CommentDao extends BaseMapper<CommentEntity> {

    /**
     * 按父评论id查询所有子评论
     *
     * @param parentId 父评论id
     * @param sort     排序字段(按点赞量排序、按发评时间排序)
     * @return List<CommentEntity>
     */
    List<CommentEntity> queryChildByParentId(@Param("parentId") Long parentId, @Param("sort") String sort);

    /**
     * 查询出该评论的所有子评论ids
     *
     * @param parentId 父评论id
     */
    List<Long> queryChildIdsByParentId(@Param("parentId") Long parentId);

}
